import 'package:flutter/widgets.dart';

extension BuildContextExtension on BuildContext {

  /// 获取当前组件的RenderBox
  RenderBox? renderBox() {
    return findRenderObject() as RenderBox?;
  }

  /// 获取当前组件的position
  Offset? position({ Offset offset = Offset.zero }) {
    return renderBox()?.localToGlobal(offset);
  }
}
